<?php
/**
 * 首页公共控制器
 * @author liuyemin
 *
 */
class HomeController extends Controller{
	
	protected $_title;	//标题
	protected $_keywords;	//关键字
	protected $_description;	//描述
	protected $_config = array();	//存储数据库的配置信息
	
	/**
	 * 初始化
	 * @see CController::init()
	 */
	public function init(){
		//从缓存取值
		$this->_config = Yii::app()->cache->get('config');
		
		//通过缓存判断是否有值
		if($this->_config == false){
			$config = Config::model()->find();
			$configData = array('title','keywords','description','record');
			foreach($configData as $v){
				$this->_config[$v] = $config->$v;
			}
			Yii::app()->cache->set('config', $this->_config);
		}
		
		Yii::app()->name = $this->_config['title'];
	}
}